#pragma once
#include "SDL.h"
#include "SDL_ttf.h"
#include "checkers.h"
#include <string>
#include "menu.h"

using namespace std;


class game
{
protected:
	/**
	* @brief ktoro sprawdza czy gra sie toczy.
	*/
	bool isGameStarted;
	/**
	* @brief szerokosc okna.
	*/
	unsigned int scrWidth;
	/**
	* @brief wysokosc okna.
	*/
	unsigned int scrHight;
	/**
	* @brief ilosc kolorow.
	*/
	unsigned int scrBpp;
	//Pola zwiazane z grafika
	SDL_Surface *screen;
	SDL_Surface *bground;
	SDL_Surface *white;
	SDL_Surface *black;
	SDL_Surface *blackKing;
	SDL_Surface *whiteKing;
	SDL_Surface *chckBlack;
	SDL_Surface *chckWhite;
	SDL_Surface *chckWhiteKing;
	SDL_Surface *chckBlackKing;
	SDL_Surface *red;
	SDL_Surface *newClassic;
	SDL_Surface *newClassicMSO;
	SDL_Surface *newSpeed;
	SDL_Surface *newSpeedMSO;
	SDL_Surface *AiOn;
	SDL_Surface *AiOnMSO;
	SDL_Surface *AiOff;
	SDL_Surface *AiOffMSO;
	SDL_Surface *exit;
	SDL_Surface *exitMSO;
	SDL_Surface *log;
	SDL_Surface *b_side;
	SDL_Surface *w_side;
	SDL_Surface *c_win;
	SDL_Surface *b_win;


	SDL_Surface *logText;
	SDL_Surface *logText2;
	SDL_Color kolor;
	TTF_Font *font;
	
	//chcknet *netconn;
	//Pola zwiazane z mechanizmem zdarzen
	bool exitApp;
	/**
	* @brief Czy lewy klawisz myszy zostal nacisniety.
	*/
	bool LMP;
	int keys[256];
	/**
	* @brief pole okreslajace zdarzenia.
	*/
	SDL_Event events;
	SDL_Surface *SDLKursor;
	Uint32 MouseX, MouseY;
	Uint8 *keyState;
	/**
	*@brief wskaznik na menu gry
	*/
	MenuItem *mainMenu;
	bool msoExit, msoClassic, msoSpeed, msoAi;

	
	bool Init_SDL(void);

	void Exit(void);
	bool Blit(SDL_Surface *src, int Offset_X, int Offset_Y);
	SDL_Surface *LoadImage(string filename);
	void redraw(/*se da tutaj klasa warcaby, pole tablica*/);
	void Mouse(void);

public:
	game(unsigned int hight, unsigned int width, unsigned int bpp);
	~game(void);
	int start(void);
	checkers *brdCheckers;

	bool drawMoves(vector<pos> allPos);
	bool draw(bool debugMode);
	void mouseOver(void);
};

